﻿// See https://aka.ms/new-console-template for more information
using WampSharp.V2.Realm;
using WampSharp.V2;
using WampShare;
using WampRouter;

Console.WriteLine("Hello, router!");


using (IWampHost host = new DefaultWampHost(ICamService.Location))
{
    IWampHostedRealm realm = host.RealmContainer.GetRealmByName(ICamService.RealmStr);

    // Host WAMP application components
    var camServices = new CamServices();

    await camServices.InitService(realm);

    host.Open();

    Console.WriteLine("Server is running on " + ICamService.Location);


    //test
    //camServices.OpenCam();

    Console.ReadLine();


    ////避免后台服务终止
    //while (true)
    //{
    //    await Task.Delay(1000 * 60 * 60 * 24);
    //    await Console.Out.WriteLineAsync("listening...");
    //}

    await Task.Yield();
}